﻿package PinballCode.Screens
{
	import flash.display.Sprite;
	import flash.display.Stage;
	import PinballCode.MainApp;
	import flash.display.MovieClip;
	
	
	// Screen class
	public class Screen extends MovieClip
	{
		protected var app:MainApp;		// main app is stored
		
		// constructor
		public function Screen(m:MainApp)
		{
			trace(this + "created");
			app = m;
		}
		
		// brings in the screen
		public function bringIn()
		{
			if (app != null)
			{
				trace("M");
				app.addChild(this);
			}
		}
		
		// brings out this screen
		public function bringOut()
		{
			cleanUp();
		}
		
		// removes this screen from MainApp
		public function cleanUp()
		{
			if (parent != null)
			{
				parent.removeChild(this);
			}
		}
	}
}